﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WebApiV2.Domain;
using WebApiV2.Interface;
using WebApiV2.Utils;

namespace WebApiV2.Api.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly IRespository<Student> _Sturesponsitory;
        private readonly IRespository<Collge> _Colrespository;

        public TestController(IRespository<Student> Sturespository,IRespository<Collge> Colresponsitory)
        {
            _Sturesponsitory = Sturespository;
            _Colrespository = Colresponsitory;
        }

        public  string Get()
        {
            _Colrespository.Insert(new Collge
            {
                CollgeName = "忍者学院",
                DeanName="旗木卡卡西"
            }) ;

            var list = _Colrespository.Table.ToList();
            return JsonHelper.SerializeObject(list);
        }

    }
}